﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BindingBasics
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //Persona miguel = new Persona() { Edad = 28, Nombre = "Miguel Ruiz" };
            //Persona soni = new Persona() { Edad = 25, Nombre = "Sonia Blanco" };
            //soni.CumplirAnnos();


            textBox1.Text = "Sonia Blanco";
            textBox2.Text = "25";
            textBox1.Tag = "1019";

        }

        private void button1_Click(object sender, EventArgs e)
        {
            textBox2.Text = (int.Parse(textBox2.Text) + 1).ToString();
            Save(textBox2, textBox1.Tag.ToString());
        }

        private void Save(TextBox textBoxEdad, string id)
        {
            MessageBox.Show("guardado:" + id + " con anngo: " + textBoxEdad.Text.ToString());
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "Miguel Ruiz";
            textBox1.Tag = "8010";
            textBox2.Text = "28";
        }

        
    }
}
